const sys = require(`./system.js`)
const title = '助学签到'
const $ = sys.$(title)

sys.run($, 'task:all', (resList, cookie, index, username, password) => {
    return new Promise(async resolve => {
        // 请求接口
        const signResp = await $.publicJS.sign($, cookie)
        
        // 追加信息
        resList.push({
            ...signResp,
            '序号': index + 1,
            username
        })
        resolve(resList)
    })
}, (resList) => {
    if (resList && resList.length > 0) {
        // 处理存储列表
        resList = resList.sort((a1, a2) => {
            return a1['序号'] - a2['序号']
        })
        console.log('任务结束 resList:', resList)
    }
    
})
